package com.jch.demo.aop.aspect;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.util.Arrays;

@Order(1) // 设置切面优先级 数字越小优先级越大
@Aspect
@Component
public class VerifyAspect {

//    @Before("execution(* com.jch.demo.aop.beans.ArithmeticCalculator.*(..))")
    @Before("com.jch.demo.aop.aspect.LoggingAspect.declareJoinPointExpression()")
    public void verifyMethodParameters(JoinPoint joinPoint){
        System.out.println("verify MethodName: " + joinPoint.getSignature().getName() + " verify parameters: " + Arrays.asList(joinPoint.getArgs()));
    }

}
